#include "CcTestVideoSurface.h"

#include <QGraphicsProxyWidget>
#include <QHBoxLayout>
#include <QVBoxLayout>

CcTestVideoSurface::CcTestVideoSurface(QObject *parent)
	: QGraphicsScene(parent)
{
    m_containter = new QWidget();
    m_containter->setObjectName(QStringLiteral("tip_container"));
    m_containter->setStyleSheet("#tip_container { background-color: transparent;}");
    
    m_tipsInfoLabel = new QLabel(nullptr);
    m_tipsInfoLabel->setFixedSize(120, 38);
    m_tipsInfoLabel->setObjectName(QStringLiteral("tip"));
    m_tipsInfoLabel->setStyleSheet("#tip { background-color: rgba(10,132,254,0.6); border: none; border-radius: 15px; font-size:12px; color:#edf1fa;}");
    m_tipsInfoLabel->setAlignment(Qt::AlignCenter);
    m_tipsInfoLabel->setText("测试悬浮在view");
    auto tipLayout = new QHBoxLayout;
    tipLayout->setSpacing(0);
    tipLayout->setMargin(0);
    tipLayout->addStretch();
    tipLayout->addWidget(m_tipsInfoLabel);
    tipLayout->addStretch();
    
    auto layout = new QVBoxLayout(m_containter);
    layout->setSpacing(0);
    layout->setMargin(0);
    layout->addStretch();
    layout->addLayout(tipLayout);
    layout->addSpacing(4);
    
    addWidget(m_containter)->setZValue(102);
}

CcTestVideoSurface::~CcTestVideoSurface(void)
{
    
}

void CcTestVideoSurface::showTips()
{
    if (m_containter)
    {
        m_containter->setVisible(true);
    }
}
